USE [NguyenHoa]
GO

IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = OBJECT_ID(N'[DBO].[F_GETDATE]') AND XTYPE IN (N'FN', N'IF', N'TF'))
DROP FUNCTION [DBO].[F_GETDATE]
GO

CREATE FUNCTION [dbo].[F_GETDATE]
(@Date DATETIME)
RETURNS DATETIME AS
BEGIN
	DECLARE @result DATETIME
	SET @result = CONVERT (DATETIME,CONVERT(VARCHAR(2),MONTH(@Date)) + 
					'/'+ CONVERT(VARCHAR(2),DAY(@Date)) + 
					'/'+ CONVERT(VARCHAR(4),YEAR(@Date)))
RETURN @result
END
GO

